import request from '@/utils/request'

// 获取商品列表
export const commodityList = (data) => {
  return request('/goods', {
    params: data
  })
}

// 删除
export const delCommodityList = (id) => {
  return request.delete(`/goods/${id}`)
}

// 获取商品详情
export const detailsList = (data) => {
  return request('/goods', {
    params: data
  })
}

// 商品分类列表
export const classification = () => {
  return request('/categories')
}

// 商品参数
export const getCategories = (id) => {
  return request(`/categories/${id}/attributes`, {
    params: {
      sel: 'many'
    }
  })
}

// 商品属性
export const getAttribute = (id) => {
  return request(`/categories/${id}/attributes`, {
    params: {
      sel: 'only'
    }
  })
}

// 添加
export const addAttribute = (data) => {
  return request.post('/goods', data)
}

// 分类参数添加
// 商品参数
export const addCategories = (id, data) => {
  return request.post(`/categories/${id}/attributes`, data)
}

// 回显
export const Echo = (id, params) => {
  return request(`/categories/${id}/attributes/${id}`, params)
}

// 修改参数
export const xiugaiUser = (id, data) => {
  return request.put(`/categories/${id}/attributes/${id}`, data)
}

// 删除
export const deleteList = (id) => {
  return request.delete(`/categories/${id}/attributes/${id}`)
}
